import request from '@/utils/request'

/**
 * 分页查询信息点列表
 */
export function pageListSensor(query) {
    return request({
        url: '/app-api/business/sensor/page/list',
        method: 'get',
        params: query
    })
}

export function listSensorByGatewayId(gatewayId) {
    return request({
        url: `/app-api/business/sensor/select/list/${gatewayId}`,
        method: 'get'
    })
}

// 查询信息点列表
export function listSensor(query) {
    return request({
        url: '/app-api/business/sensor/list',
        method: 'get',
        params: query
    })
}

// 查询信息点详细
export function getSensor(sensorId) {
    return request({
        url: '/app-api/business/sensor/' + sensorId,
        method: 'get'
    })
}

// 新增信息点
export function addSensor(data) {
    return request({
        url: '/app-api/business/sensor',
        method: 'post',
        data: data
    })
}

// 修改信息点
export function updateSensor(data) {
    return request({
        url: '/app-api/business/sensor',
        method: 'put',
        data: data
    })
}

// 删除信息点
export function delSensor(sensorId) {
    return request({
        url: '/app-api/business/sensor/' + sensorId,
        method: 'delete'
    })
}

// 修改信息点采集开关
export function changeTriggerStatus(data) {
    return request({
        url: '/app-api/business/sensor/changeTriggerStatus',
        method: 'put',
        data: data
    })
}

// 修改信息点报警开关
export function changeWarnEnable(data) {
    return request({
        url: '/app-api/business/sensor/changeWarnEnable',
        method: 'put',
        data: data
    })
}

// 修改信息点采集频率
export function changeSpeed(data) {
    return request({
        url: '/app-api/business/sensor/changeSpeed',
        method: 'put',
        data: data
    })
}

// 修改信息点基本信息
export function changeInfo(data) {
    return request({
        url: '/app-api/business/sensor/changeInfo',
        method: 'put',
        data: data
    })
}

export function listSelectByGatewayId(gatewayId) {
    return request({
        url: `/app-api/business/sensor/select/list/${gatewayId}`,
        method: 'get'
    })
}

export function listSelect() {
    return request({
        url: '/app-api/business/sensor/select/list',
        method: 'get'
    })
}

/**
 * 查询信息点报警记录
 */
export function pageWarnList(query) {
    return request({
        url: '/app-api/business/sensor/page/warn/list',
        method: 'get',
        params: query
    })
}

/**
 * 查询信息点报警未处理条数
 */
export function getWarnCount() {
    return request({
        url: '/app-api/business/sensor/warn/count',
        method: 'get'
    })
}

/**
 * 把报警记录标记为已处理
 */
export function processWarn(data) {
    return request({
        url: '/app-api/business/sensor/process/warn',
        method: 'post',
        data: data
    })
}


